package cn.e2win.base.interceptor;

import java.util.logging.Logger;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;

import cn.e2win.biz.security.DmsSecurityMetadataSource;



public class AuthorizeInterceptor extends HandlerInterceptorAdapter {

	static Log logger = LogFactory.getLog(DmsSecurityMetadataSource.class);
	public AuthorizeInterceptor(){
		logger.info("====================in AuthorizeInterceptor");
	}
	@Override
	public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object command) throws Exception {
	
		System.err.println("开始访问action--"+request.getRequestURI());

		return true;
	}

	@Override
	public void afterCompletion(HttpServletRequest request,
			HttpServletResponse response, Object handler, Exception ex)
			throws Exception {
		
		System.err.println("访问结束,可关闭--"+request.getRequestURI());
		super.afterCompletion(request, response, handler, ex);
	}

	@Override
	public void postHandle(HttpServletRequest request,
			HttpServletResponse response, Object handler,
			ModelAndView modelAndView) throws Exception {
		System.err.println("开始返回视图action--"+request.getRequestURI());
		super.postHandle(request, response, handler, modelAndView);
	}
	
	public static void main(){
		System.err.println("中华");
	}
}
